import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CleanerLogVO, CleanerLogForm, CleanerLogQuery } from '@/api/tearoom/cleanerLog/types';

/**
 * 查询保洁记录列表
 * @param query
 * @returns {*}
 */

export const listCleanerLog = (query?: CleanerLogQuery): AxiosPromise<CleanerLogVO[]> => {
  return request({
    url: '/tearoom/cleanerLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保洁记录详细
 * @param id
 */
export const getCleanerLog = (id: string | number): AxiosPromise<CleanerLogVO> => {
  return request({
    url: '/tearoom/cleanerLog/' + id,
    method: 'get'
  });
};

/**
 * 新增保洁记录
 * @param data
 */
export const addCleanerLog = (data: CleanerLogForm) => {
  return request({
    url: '/tearoom/cleanerLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改保洁记录
 * @param data
 */
export const updateCleanerLog = (data: CleanerLogForm) => {
  return request({
    url: '/tearoom/cleanerLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除保洁记录
 * @param id
 */
export const delCleanerLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/cleanerLog/' + id,
    method: 'delete'
  });
};
